import { Outlet, useLocation } from 'react-router'

import { CusAgGridTable } from './components/CusAgGridTable'
import { Filter } from './components/Filter'
import { Header } from './components/Header'
import { useWaybillList } from './useWaybillList'
import styles from './styles.module.less'

const ListInner = () => {
  useWaybillList()

  return (
    <div className={styles.box}>
      <div className={styles.filter}>
        <Filter />
      </div>
      <div className={styles.main}>
        <Header />
        <div className={styles.main_body}>
          <CusAgGridTable />
        </div>
      </div>
    </div>
  )
}

export const List = () => {
  const { pathname } = useLocation()
  if (pathname.startsWith('/biz/trackManage/list/detail')) return <Outlet /> // 有详情页
  return <ListInner />
}
